#ifndef _BT_TILEENGINE_H_
#define _BT_TILEENGINE_H_

#include "bt.h"

class BaseTile
{
	friend class TileSet;
	
public:
	BaseTile();
	~BaseTile();
	
private:
	Uint8 curFrame, startFrame, endFrame;
};

//
// Stores Base Tile image and shape data
//
class TileSet
{
public:
	TileSet();
	
	TileSet(int tileSize));
	
	~TileSet();
	
	// Mutators
	void appendTiles(Animation* anim);
	
	// Actions
	void start();
	void stop();
	void reset();
	
private:
	vector<BaseTile> tiles;
		
	Animation anim;
};


//
// Basic TileEngine unit
//
class Tile
{
	friend class TileEngine;
	
public:
	Tile();
	
	~Tile();
	
private:
	Uint8 baseTile;
		
	bool visible;
	bool passable;
	float strength;
};


//
// Stores level data
//
class TileEngine
{
	friend class TileCamera;
	
public:
	TileEngine();
	
	~TileEngine();
	
private:
	Tile*** map;
	
	int physLayer;	// Physical Layer: objects interact with this layer
	
	Animation background;
};


//
// Used to draw the specified TileEngine in the current GL viewport
//
class TileCamera
{
public:
	TileCamera();
	
	TileCamera(TileEngine* engine);
	
	~TileCamera();
	
	// Actions
	void drawLayer(unsigned int layer);
	void drawBackground();
	void drawShapes();
	void drawForeground();
	
private:
	TileEngine* engine;
	
	int tileX, tileY;
	float offsetX, offsetY;
};

#endif /* _BT_TILEENGINE_H_ */
